﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace myCollection
{
    public partial class IndexFiles : Form
    {
        public IndexFiles()
        {
            InitializeComponent();
            this.refreshDGV();
        }

        private void refreshDGV()
        {
            dataGridView1.Rows.Clear();
            SQLite sqlite = new SQLite();
            sqlite.Connect();
            DataTable dt = new DataTable();
            dt = sqlite.GetAllFiles(tbFile.Text);
            sqlite.Disconnect();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dataGridView1.Rows.Add(dt.Rows[i]["id"].ToString(), dt.Rows[i]["id1"].ToString(), (i + 1).ToString(), dt.Rows[i]["file"].ToString(), dt.Rows[i]["name"].ToString());
            }
        }

        private void btSearch_Click(object sender, EventArgs e)
        {
            this.refreshDGV();
        }
    }
}
